package lifei.lifei.spring.service.Impl;

import lifei.lifei.spring.dao.ISysLogDao;
import lifei.lifei.spring.service.ISysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 小李
 * @version 1.0
 * @date 2021/9/26 10:42
 */
//业务层接口实现类
@Component("iSysLogService")
//@Service
public class ISysLogServiceImpl
        implements ISysLogService {
    //使用new对象的方式创建接口层的对象
//    private ISysLogDao iSysLogDao=
//            new ISysLogDaoImpl();
//    private ISysLogDao iSysLogDao=
//            (ISysLogDao)BeanFactory.getBean("ISysLogDao");
    @Autowired
    ISysLogDao iSysLogDao;
    @Override
    public void saveSysLog() {
        //启动spring容器
//        ApplicationContext context =
//                new ClassPathXmlApplicationContext(
//                "applicationContext.xml");
//        ISysLogDao iSysLogDao =
//                 context.getBean(
//                        "iSysLogDao",
//                        ISysLogDao.class);
        System.out.println(
                "调用dao层的方法将日志添加到数据库");
//       //业务层实现类，实现业务需要调用持久层接口
        iSysLogDao.addSysLog();
    }
}